<template>
    <div class="dayu-container">
        <span>最近</span>
        <InputNumber class="dayu" :value="monthBefore"></InputNumber>
        <span>个月之内，变更</span>
        <InputNumber class="dayu" :value="chgCount"></InputNumber>
        <span>次</span>
    </div>
</template>

<style scoped>
.dayu{
    width:80px;
}
.dayu-container{
    display:inline-block;
}
</style>

<script>
export default {
    name: 'DaYu',
    props:['val'],
    computed: {
        monthBefore: function(){
            let result = 0;
            if(this.val){
                // determinationData格式为{"monthBefore":"36","chgCount":"0"}
                let valObj = JSON.parse(this.val);
                if(valObj.monthBefore){
                    result = valObj.monthBefore
                }
            }
            return result;
        },
        chgCount: function(){
            let result = 0;
            if(this.val){
                // determinationData格式为{"monthBefore":"36","chgCount":"0"}
                let valObj = JSON.parse(this.val);
                if(valObj.chgCount){
                    result = valObj.chgCount
                }
            }
            return result;
        }
    }
}
</script>
